package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppYardPlan;
import com.ep.modules.app.service.AppYardPlanService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/yard_plan")
public class AppYardPlanController {
    @Autowired
    private AppYardPlanService appYardPlanService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appYardPlanService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppYardPlan appyardplan = appYardPlanService.getById(id);
        return R.ok().put("appyardplan", appyardplan);
    }

    @SysLog("保存AppYardPlan")
    @PostMapping("/save")
    public R save(@RequestBody AppYardPlan appyardplan) {
        ValidatorUtils.validateEntity(appyardplan);
        appYardPlanService.save(appyardplan);
        return R.ok();
    }

    @SysLog("修改AppYardPlan")
    @PostMapping("/update")
    public R update(@RequestBody AppYardPlan appyardplan) {
        ValidatorUtils.validateEntity(appyardplan);
        appYardPlanService.update(appyardplan);
        return R.ok();
    }

    @SysLog("删除AppYardPlan")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appYardPlanService.deleteBatch(ids);
        return R.ok();
    }
}